from datetime import datetime

from django.db import models


# 权限表
class authorities(models.Model):
    # 权限名称（酒店职员类型）
    type = models.CharField(max_length=63)
    # 权限等级
    authority = models.IntegerField(blank=True, null=True)


# 职位表
class position(models.Model):
    name = models.CharField(max_length=63)
    department = models.ForeignKey('department', on_delete=models.CASCADE)


# 部门表
class department(models.Model):
    name = models.CharField(max_length=63)


# 部门项目表
class project(models.Model):
    name = models.CharField(max_length=63)
    department = models.ForeignKey('department', on_delete=models.CASCADE)


# 职员表，存储每一位酒店职员信息
class staff(models.Model):
    # 职员姓名
    name = models.CharField(max_length=63)
    # face_id
    face_id = models.CharField(max_length=31, null=True)
    # 职员级别
    level = models.ForeignKey('authorities', on_delete=models.CASCADE)
    # 密码
    password = models.CharField(max_length=63, null=True)
    # 性别
    gender = models.SmallIntegerField(default=0)
    # 工号
    number = models.CharField(max_length=12)
    # 部门
    department = models.ForeignKey('department', on_delete=models.CASCADE)
    # 职位
    position = models.ForeignKey('position', on_delete=models.CASCADE)
    # 联系方式
    telephone = models.CharField(max_length=11)
    # 注册时间
    reg_date = models.DateField()
